<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all">
		<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
	</head>
	<body>
		<!--start-header-section-->
		<div class="header">
			<div class="container">
				<div class="header-top">
					<div class="logo">
						<h1><a href="main.html" target="main">蜗牛共享车位--Share Parking Space</a></h1>
					</div>
					<div id="manager">
						<a  id="loginButton" title="点击登录"  ><img src="images/manager.png" /><span id="logintext">登录</span></a>
						<a  id="registerButton" title="点击注册" href="register.html" target="main" ><span>注册</span></a>
						<a  id="logoutButton" title="点击注销" href="/logout" ><span>注销</span></a>

					</div>
				</div>
			</div>
		</div>
		<div class="header-bottom" style="display: block;background-color: rgb(28,118,237);">
			<nav class="navbar navbar-default">
				<div class="container-fluid">
					<!-- Collect the nav links, forms, and other content for toggling -->
					<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
						<ul class="nav navbar-nav cl-effect-16">
							<li class="dropdown">
								<a href="main.html"target="main" >首页<span class="sr-only">(current)</span></a>
								</li>
							<li class="dropdown">
							  <a href="lessor.html" target="main" >出租车位</a>
							</li>
							<li class="dropdown">
							  <a href="tenant.html" target="main" >租赁车位</a>
							</li>
							<li class="dropdown">
							  <a href="property.html" target="main" >物业管理</a>
							</li>
							<li><a href="contact.html" target="main">联系我们</a></li>
						</ul>
					</div>
				</div>
			</nav>
		</div>
		<script src="js/jquery-3.5.1.js"></script>
		<script>
			//登陆按钮点击事件
			$("#loginButton").click(function(){
					top.location= "/login.html";
					// event.target="_parent";
			});
			//注销按钮点击事件
			$("#logoutButton").click(function(){
				$("#logintext").html("登录");
				// location.reload();
				// top.location.reload();
			});
			$.ajax({
				url:"/user",
				dataType:"json",
				success:function(data){
					if(data.code=="1"){
						$("#logintext").html(data.object.userLogin);
						$("#loginButton").css('class','disabled');
						console.log(data)
					}else{
						console.log(data);
						alert(data.message);
					}
				}
			})

		</script>
	</body>
</html>
